package day1107.demo03;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Period;
import java.util.function.Predicate;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-07 09:41
 **/
public class Test {
    public static void main(String[] args) {
        LocalDate date = LocalDate.of(2020, 11, 1);
        LocalDate now = LocalDate.now();
        //比较两个日期的距离
        Period period = Period.between(date, now);
        System.out.println("相差的年:"+ period.getYears());
        System.out.println("相差的月:"+ period.getMonths());
        System.out.println("相差的天:"+ period.getDays());

        LocalTime time = LocalTime.of(8, 12, 12);
        LocalTime now1 = LocalTime.now();
        Duration between = Duration.between(time, now1);
        System.out.println(between.toHours());
        System.out.println(between.toMinutes()); //时间与时间之间相差的分钟
        System.out.println(between.getSeconds());//时间与时间之间相差的秒


    }
}
interface  A{
      public void show();

      //默认方法
      default  void fun(){

      }

      //静态方法
      static void fun2(){

      }
}